<template>
    <div class="main">
        <!-- 布局页 -->
        <el-container class="container">
            <!-- 菜单按钮-->          
            <el-aside width="80px">
              <div class="icon-text-container">
                <div class="icon-text-container-button" @click="navGoToMenu('/test')">
                  <img src="../../assets/icon_files.png" class="icon-image">
                  <span class="icon-text">测试通信</span>
                </div>
              </div>

              <div class="icon-text-container">
                <div class="icon-text-container-button" @click="navGoToMenu('/files')">
                  <img src="../../assets/icon_files.png" class="icon-image">
                  <span class="icon-text">数据</span>
                </div>
              </div>

              <div class="icon-text-container">
                <div class="icon-text-container-button"  @click="navGoToMenu('/terminal')">
                  <img src="../../assets/icon_terminal.png" class="icon-image">
                  <span class="icon-text">终端</span>
                </div>
              </div>

              <div class="icon-text-container">
                <div class="icon-text-container-button"  @click="navGoToMenu('/transfer')">
                  <img src="../../assets/icon_transfer.png" class="icon-image">
                  <span class="icon-text">传输</span>
                </div>
              </div>

              <div class="icon-text-container" style="position: absolute;bottom: 0px">
                <div class="icon-text-container-button" style="width: 57px;height:59px;"  @click="logoutSystem">
                  <img src="../../assets/icon_logout.png" class="icon-image">
                  <span class="icon-text">退出</span>
                </div>
              </div>

            </el-aside>
            <!-- 右侧 -->
            <el-container>
                <!-- 右侧主题 ,style="margin: 0;height: 100%;" 100%显示-->
                <el-main style="margin: 0;height: 100%;">
                  <!-- 路由出口 -->
                  <router-view />
                </el-main>
            </el-container>
            
        </el-container>
    </div>
</template>

<script setup>

import welcome from '@/views/admin/welcome/index.vue'

import { reactive } from 'vue'
import { ref } from 'vue'
import { useRouter } from 'vue-router'

//定义路由
const router = useRouter()

const navGoToMenu = (menu) => {
  router.push(menu) // 跳转到路由
};

const logoutSystem = () =>{
  router.push("/admin")
}

</script>

<style lang="scss" scoped>
  .main{
    padding:0;  /*去除内边距*/
    border:0;   /*去除边框*/
    margin:0;   /*去除外边距*/
    overflow:hidden;
    width:100%;
    height:100%;
    margin: 0px 0px;
  }

  .header_main{
    width: 100%;
    height:35px;
    background-color: #fff;
    padding-top: 10px;
  }
  
  .logout{
    color: #127de0;
    text-decoration: none;
    size: 25px;
    margin: 10px;
  }
  .logout:hover{
    color: #043b83;
    cursor:pointer;
  }

  .container{
    padding:0;  /*去除内边距*/
    border:0;   /*去除边框*/
    margin:0;   /*去除外边距*/
    overflow:hidden;
    width:100%;
    height:100%;
    margin: 0px 0px;
  }  

  .el-header, .el-footer {
    background-color: #353333;
    color: rgb(0, 0, 0);
    text-align: right;
    --el-header-height: 45px;
    --el-header-padding: 0 0px;
    height: 45px;
    width: 100%;
    margin: auto;
    position: relative;
  }
  
  .el-aside {
    background-color: #dde6ee;
    color: #333;
    text-align: center;
    //line-height: 200px;
    border:0;
    position: relative; /* 确保父容器相对定位 */
  }
  
  .el-main {
    background-color: #e6f2ff;
    color: #333;
    text-align: center;
  }
  
  body > .el-container {
    padding:0;  /*去除内边距*/
    border:0;   /*去除边框*/
    margin:0;   /*去除外边距*/
    overflow:hidden;
    width:100%;
    height:inherit;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }


  //菜单样式
  .icon-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100; /* 可根据需要调整 */
    margin: 10px;
    padding-bottom: 20px;
  }

  .icon-text-container-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 95%;
    padding: 3px;
    cursor: pointer; /* 鼠标移动到容器上时变成手势 */
    transition: box-shadow 0.1s ease; /* 过渡效果 */
  }
  .icon-text-container-button:active {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 点击时的阴影效果 */
  }
  .icon-text-container-button:hover {
    outline: 1px solid #7eb9f8; /* 鼠标经过时的边框,不占位置的边框 */
  }

  .icon-image {
    width: 40px; /* 可根据需要调整 */
    height: 40px; /* 可根据需要调整 */
    margin-bottom: 0px; /* 图标和文字之间的间距 */
  }

  .icon-text {
    font-size: 14px; /* 可根据需要调整 */
    color: rgb(8, 8, 8);
  }
  //菜单样式结束

</style>